package me.zfz.business.controller.impl;

import me.zfz.base.bean.SmartResponse;
import me.zfz.business.bean.RegisterUser;
import me.zfz.business.bean.SubmitDataBean;
import me.zfz.business.bean.entity.TNRole;
import me.zfz.business.controller.base.BaseController;
import me.zfz.business.service.OPService;
import me.zfz.business.service.StudentInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

/**
 * 注册
 */
@Controller
@RequestMapping("/register")
public class RegisterController extends BaseController {

    @Autowired
    private OPService opServ;
    @Autowired
    private StudentInfoService studentInfoService;

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView index(ModelAndView modelView) throws Exception {
        modelView.setViewName("register");
        return modelView;
    }

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public @ResponseBody
    SmartResponse<String> add(RegisterUser registerUser) throws Exception {
        return studentInfoService.save(registerUser);
    }

}
